home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / faq / news / perl_faq / part2 < prev    next >
Text File  |  1993-10-01  |  24KB  |  612 lines

  1. Newsgroups: comp.lang.perl,news.answers
  2. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!spool.mu.edu!agate!boulder!wraeththu.cs.colorado.edu!tchrist
  3. From: Tom Christiansen <tchrist@cs.Colorado.EDU>
  4. Subject: Perl Frequently Asked Questions, part 2 of 4
  5. Message-ID: <CE9BqE.25o@Colorado.EDU>
  6. Followup-To: comp.lang.perl
  7. Originator: tchrist@wraeththu.cs.colorado.edu
  8. Sender: news@Colorado.EDU (USENET News System)
  9. Organization: University of Colorado at Boulder
  10. Date: Sat, 2 Oct 1993 06:37:26 GMT
  11. Approved: news-answers-request@MIT.Edu
  12. Expires: Wed, 1 Dec 1993 12:00:00 GMT
  13. Lines: 596
  14. Xref: senator-bedfellow.mit.edu comp.lang.perl:20583 news.answers:13121
  15.  
  16. Archive-name: perl-faq/part2
  17. Version: $Id: perl-info2,v 1.1 93/10/02 00:27:07 tchrist Exp Locker: tchrist $
  18.  
  19. This posting contains answers to general information questions,
  20. mostly of a non-technical nature.  The following questions are 
  21. answered in this posting:
  22.  
  23. 1.21) Is there a Perl profiler?
  24. 1.22) Is there a yacc for Perl?
  25. 1.23) How can I use curses with perl?
  26. 1.24) How can I use X with Perl?
  27. 1.25) What is perl4?  What is perl5?
  28. 1.26) How does Perl compare with languages like REXX or TCL?
  29. 1.27) Is it a Perl program or a Perl script?
  30. 1.28) What's the difference between "Perl" and "perl"?
  31. 1.29) What companies use or ship Perl?
  32. 1.30) Is there commercial, 3rd-party support for Perl?
  33. 1.31) Where can I get a list of the JAPH signature quotes?
  34. 1.32) Where can I get a list of Larry Wall witticisms?
  35. 1.33) Is there a pretty-printer for Perl?
  36. 1.34) Can I dynamically load C user routines?
  37.  
  38.  
  39. 1.21) Is there a Perl profiler?
  40.  
  41.     While there isn't one included with the perl source distribution (yet)
  42.     various folks have written packages that allow you to do at least some
  43.     sort of profiling.  The strategy usually includes modifying the perl
  44.     debugger to handle profiling.  Authors of these packages include
  45.  
  46.     Wayne Thompson         <me@anywhere.EBay.Sun.COM>
  47.     Ray Lischner         <lisch@sysserver1.mentor.com>
  48.     Kresten Krab Thorup     <krab@iesd.auc.dk>  
  49.  
  50.     The original articles by these folks containing their
  51.     profilers are available on convex.com in 
  52.     /pub/perl/information/profiling.shar via anon ftp.
  53.  
  54.  
  55. 1.22) Is there a yacc for Perl?
  56.  
  57.     Yes!! It's a version of Berkeley yacc that outputs Perl code instead
  58.     of C code!  You can get this from ftp.sterling.com [192.124.9.1] in
  59.     /local/perl-byacc1.8.1.tar.Z, or send the author mail for details.
  60.  
  61.  
  62. 1.23) How can I use curses with perl?
  63.  
  64.     One way is to build a curseperl binary by linking in your C curses
  65.     library as described in the usub subdirectory of the perl sources.
  66.     This requires a modicum of work, but it will be reasonably fast
  67.     since it's all in C (assuming you consider curses reasonably fast. :-)  
  68.     Programs written using this method require the modified curseperl,
  69.     not vanilla perl, to run.  While this is something of a disadvantage,
  70.     experience indicates that it's better to use curseperl than to 
  71.     try to roll your own using termcap directly.
  72.  
  73.     For a good example of using curseperl, you might want to pick up a
  74.     copy of  Steven L Kunz's <skunz@iastate.edu> "perl menus" package
  75.     ("menu.pl") via anonymous FTP from "ftp.iastate.edu".  It's in the
  76.     /pub/perl as
  77.  
  78.     menu.pl.v1.4.shar
  79.     menu.pl.v2.0.shr1
  80.     menu.pl.v2.0.shr2
  81.     menu.pl.v2.0.tar.Z
  82.  
  83.     menus.pl is a complete menu front-end for curseperl and demonstates
  84.     a lot of things (plus it is useful to boot if you want full-screen
  85.     menu selection ability).
  86.  
  87.     Another possibility is to use Henk Penning's cterm package, a curses
  88.     emulation library written in perl.  cterm is actually a separate
  89.     program with which you communicate via a pipe.  It is available from
  90.     ftp.cs.ruu.nl [131.211.80.17] via anonymous ftp. in the directory
  91.     pub/PERL.  You may also acquire the package via email in compressed,
  92.     uuencoded form by sending a message to mail-server@cs.ruu.nl
  93.     containing these lines:
  94.  
  95.     begin
  96.     send PERL/cterm.shar.Z
  97.     end
  98.  
  99.     See the question on retrieving perl via mail for more information on
  100.     how to get retrieve other items of interest from the mail server
  101.     there.
  102.  
  103.  
  104. 1.24) How can I use X with Perl?
  105.  
  106.     Right now, you have several choices.  You can wait for perl5, use
  107.     the WAFE or STDWIN packages, or try to make your own usub bindings. 
  108.  
  109.     Perl5 is anticipated to be released with bindings for X, called 
  110.     guiperl.  An exciting prototype for this, written by Jon Biggar
  111.     <jon@netlabs.com>, Larry's *other* brother-in-law and officemate, 
  112.     is already up and running inside of Netlabs.  This program addresses
  113.     the same dynamic gui-building problem space as does tcl/tk.
  114.     
  115.     If you can't wait or don't think that guiperl will do what you want,
  116.     a stab at Motif bindings was begun by Theodore C. Law
  117.     <TEDLAW@TOROLAB6.VNET.IBM.COM> area.  His article about this is 
  118.     on convex.com in /pub/perl/info/motif for anon ftp.
  119.  
  120.     STDWIN is a library written by Guido van Rossum <guido@cwi.nl>
  121.     (author of the Python programming language) that is portable 
  122.     between Mac, Dos and X11.  One could write a Perl agent to
  123.     speak to this STDWIN server.
  124.  
  125.     WAFE is a package that implements a symbolic interface to the Athena
  126.     widgets (X11R5). A typical Wafe application consists in our framework
  127.     of two parts: the front-end (we call it Wafe for Widget[Athena]front
  128.     end) and an application program running typically as separate process.
  129.     The application program can be implemented in an arbitrary programming
  130.     language and talks to the front-end via stdio.  Since Wafe (the
  131.     front-end) was developed using the extensible TCL shell (cite John
  132.     Ousterhout), an application program can dynamically submit requests to
  133.     the front-end to build up the graphical user interface; the
  134.     application can even down-load application specific procedures into
  135.     the front-end.  The distribution contains sample application programs
  136.     in Perl, GAWK, Prolog, TCL, and C talking to the same Wafe binary.
  137.     Many of the demo applications are implemented in Perl.  Wafe 0.9 can
  138.     be obtained via anonymous ftp from 
  139.     ftp.wu-wien.ac.at:pub/src/X11/wafe-0.9.tar.Z
  140.     (for people without name server: the ip address is 137.208.3.5)
  141.  
  142.     Alternatively, you could use wish from tcl. 
  143.  
  144.     #!/usr/local/bin/perl
  145.     #####################################################################
  146.     #  An example of calling wish as a subshell under Perl and
  147.     #  interactively communicating with it through sockets.
  148.     #
  149.     #  The script is directly based on Gustaf Neumann's perlwafe script.
  150.     #
  151.     #  Dov Grobgeld dov@menora.weizmann.ac.il
  152.     #  1993-05-17
  153.     #####################################################################
  154.  
  155.     $wishbin = "/usr/local/bin/wish";
  156.  
  157.     die "socketpair unsuccessful: $!!\n" unless socketpair(W0,WISH,1,1,0);
  158.     if ($pid=fork) {
  159.         select(WISH); $| = 1;
  160.         select(STDOUT);
  161.  
  162.     # Create some TCL procedures
  163.         print WISH 'proc echo {s} {puts stdout $s; flush stdout}',"\n";
  164.  
  165.     # Create the widgets
  166.     print WISH <<TCL;
  167.     # This is a comment "inside" wish
  168.  
  169.     frame .f -relief raised -border 1 -bg green
  170.     pack append . .f {top fill expand}
  171.  
  172.     button .f.button-pressme -text "Press me" -command {
  173.         echo "That's nice."
  174.     }
  175.     button .f.button-quit -text quit -command {
  176.         echo "quit"
  177.     }
  178.     pack append .f .f.button-pressme {top fill expand} \\
  179.                .f.button-quit {top expand}
  180.  
  181. TCL
  182.     ;
  183.     # Here is the main loop which receives and sends commands
  184.     # to wish.
  185.     while (<WISH>) {
  186.         chop;
  187.         print "Wish sais: <$_>\n";
  188.         if (/^quit/) { print WISH "destroy .\n"; last; }
  189.     }
  190.         wait;
  191.     } elsif (defined $pid) {
  192.     open(STDOUT, ">&W0");
  193.     open(STDIN, ">&W0");
  194.     close(W0);
  195.     select(STDOUT); $| = 1;
  196.     exec "$wishbin --";
  197.     } else {
  198.     die "fork error: $!\n";
  199.     }
  200.  
  201.  
  202.  
  203. 1.25) What is perl4?  What is perl5?
  204.  
  205.     The answer to what is perl4 is nearly anything you might otherwise 
  206.     program in shell or C.  The answer to what is perl5 is basically
  207.     Perl: the Next Generation.  In fact, it's essentially a complete
  208.     rewrite of perl from the bottom up, and back again.  It's available
  209.     in alpha form (alpha-2 now, alpha-3 soon).   The only docs for this stuff
  210.     is what you're about to read, and what's in the t/op/ref.t file.
  211.  
  212.     Here are the things which are already done:
  213.     a faster, tighter, more flexible interpreter 
  214.  
  215.     new token "=>" as synonym for ","; this makes 
  216.         tables look nicer
  217.         %T = ( OC => $red,
  218.               TOF => "\f",
  219.              );
  220.         and provides for named argument passing:
  221.         &some_func( OC => $red, TOF => "\f");
  222.  
  223.     recursive lists and tables:
  224.         [a, b, [c, d], e] has 4 elts, the 3rd being itself a list
  225.         $r->[3]->{PEANUT}; $r is a reference to a list 
  226.                 of references to tables
  227.  
  228.     typed pointers (references) and generalized indirection:
  229.         like @{$aptr} or &{$fptr} or &{ $table[$index] . "func" }().
  230.  
  231.     merging of list operator and function calling syntax:
  232.         split /pat/, $string;
  233.  
  234.     the ref operator to find out what something is a reference to
  235.  
  236.     object oriented programming:
  237.         $o->func(); # call the func member function of whatever class $o is
  238.  
  239.     inheritance of object types through the @ISA array
  240.     much improved -w checking
  241.     lexical scoping with the my operator
  242.  
  243.     safe global variables through package statements 
  244.         forces variable declarations, but only if you want it
  245.  
  246.     per-package END functions triggered at die() or exit()
  247.     embeddable Perl code in C code: cc prog.c -lperl 
  248.  
  249.     oo syntactic extensions:
  250.         $dog->give($bone);
  251.         is like
  252.         give $dog $bone; 
  253.         and 
  254.         $STDOUT->flush(1);
  255.         is like
  256.         flush $STDOUT 1;  
  257.     multiple co-resident perl interpreters: 
  258.  
  259.     Here is what is hoped to be done for production, but might not:
  260.     very easy GUI Perl applications using high-level X bindings ("guiperl")
  261.     subroutines without &'s:   myfunc($arg);
  262.     mnemonic aliases for $<punctuation> variables
  263.     file handle objects: $STDOUT->flush(1);
  264.     cleanup (namespace pollution) and documentation 
  265.         (eg. man 3pl getopt) of libraries
  266.     addition of several new libraries (atexit, autoload, etc.)
  267.     update h2ph and c2ph 
  268.     misc perl development tools 
  269.     a perl profiler
  270.     POSIX compatibility
  271.  
  272.     Here is what is hope to eventually be done but very probably not in
  273.     the first production release:
  274.     generalization of dbm binding for assoc arrays to handle
  275.         any generic fetch/store/open/close/flush package.
  276.         (thus allowing both dbm and gdbm at once)
  277.     dynamic loading of C libraries for systems that can
  278.     byte-compiled code for speed and maybe security
  279.  
  280.     And here are the things that will no longer work that used to:
  281.     open FILE || die;
  282.     $c = shift @a + 1;
  283.  
  284.     It's tempting to want this stuff soon, since the sooner it comes
  285.     out the sooner we can all build really cool applications.  But the
  286.     longer Larry works on it, the more items from this list will actually
  287.     get done, and the more robust the release will be.  So let's not
  288.     ask him about it too often.  Larry says (slightly edited):
  289.  
  290.     I've put a tar of my current Perl 5 directory onto
  291.     ftp.netlabs.com, in pub/outgoing/perl5.0/perl5a2.tar.Z.
  292.  
  293.     Now's your chance to check out all the bugs I said I fixed in
  294.     Perl 5.  :-)
  295.  
  296.     Before you get all twitterpated, this is unsupported "alpha 2"
  297.     code.  There is no Configure, only a makefile.  It will
  298.     probably only work on a Sun4.  The compiler and interpreter are
  299.     still very much unoptimized (though it already runs as fast or
  300.     faster than Perl 4).  It doesn't do everything that I want it
  301.     to yet.  It doesn't have "my" yet (though it's got the innards
  302.     for it).  It doesn't have a debugger.
  303.  
  304.     Like the Alpha 1 prerelease, this is an unsupported code.  It is
  305.     expected to work only on a Sparc architecture machine.  No
  306.     Configure support is provided.  In fact, if you succeed in
  307.     configuring and making a new makefile, you'll probably overwrite
  308.     the only makefile that works.  (Note that a Sparc executable comes
  309.     with the kit, so you may not need to compile at all.) There is
  310.     no list of new features yet, but if you look at t/op/ref.t
  311.     you'll see some of them in use.  perl -Dxst is also fun.
  312.  
  313.     But it does have references, and you can play with them.  The
  314.     object oriented stuff is there too.  See the op/ref.t file for
  315.     how to use them.
  316.  
  317.     I smell some new JAPHs coming...
  318.  
  319.     I don't want to get stuck "supporting" this, but if you want to
  320.     run your favorite scripts past it and see which ones toss their
  321.     salad, you may.  If you can come up with a decent bug report
  322.     with a small test case, I'll certainly be glad to look at it.
  323.     I'm not really interested in obscure core dumps at the moment.
  324.     I'm still getting plenty of those on my own.
  325.  
  326.     I'm not yet interested in memory leak reports either.
  327.  
  328.     I can tell you that no program that uses the old autoloading
  329.     mechanism will run, since there is no visibility into the
  330.     symbol table pointers currently.  You ought to be able to
  331.     redefine a subroutine while it's running, though.  (I haven't
  332.     tested that in several months, however.  There oughta be a
  333.     regression test for that...)
  334.  
  335.     Don't bother trying to diff Perl 4 with Perl 5.  Everything is
  336.     different.  All names have been regularized.  Here's a key, if
  337.     you're brave and want to peek at the sources:
  338.  
  339.         SV      scalar value
  340.         AV      array value
  341.         HV      hash value
  342.         GV      glob value
  343.         CV      code value
  344.         RV      reference value
  345.         PV      pointer value
  346.         NV      numeric value
  347.         IV      integer value
  348.  
  349.  
  350. 1.26) How does Perl compare with languages like REXX or TCL?
  351.  
  352.     REXX is an interpreted programming language first seen on IBM systems,
  353.     and TCL is John Ousterhout's embeddable command language.  TCL's most
  354.     intriguing feature for many people is the tcl/tk toolset that allows
  355.     for interpreted X-based tools.
  356.  
  357.     To avoid any flamage, if you really want to know the answer to this
  358.     question, probably the best thing to do is try to write equivalent
  359.     code to do a set of tasks.  All three have their own newsgroups in
  360.     which you can learn about (but hopefully not argue about) these
  361.     languages.
  362.  
  363.     To find out more about these or other languages, you might also check
  364.     out David Muir Sharnoff <muir@tfs.com>'s posting on "Catalog of
  365.     compilers, interpreters, and other language tools" which he posts to
  366.     comp.lang.misc, comp.sources.d, comp.archives.admin, and the
  367.     news.answers newsgroups.  It's a comprehensive treatment of many
  368.     different languages.  (Caveat lector: he considers Perl's syntax
  369.     "unappealing".)   This list is archived on convex.com in 
  370.     /pub/perl/info/lang-survey.shar .
  371.  
  372.  
  373. 1.27) Is it a Perl program or a Perl script?
  374.  
  375.     Certainly. :-)
  376.  
  377.     Current UNIX parlance holds that anything interpreted
  378.     is a script, and anything compiled into native machine
  379.     code is a program.  However, others hold that a program
  380.     is a program is a program: after all, one seldom discusses
  381.     scripts written in BASIC or LISP.  Larry considers it
  382.     a program if it's set in stone and you can't change it,
  383.     whereas if you go in and hack on it, then it's a script.
  384.  
  385.     But doesn't really matter.  The terms are generally 
  386.     interchangeable today.
  387.  
  388.  
  389. 1.28) What's the difference between "Perl" and "perl"?
  390.  
  391.      32 :-)  [  ord('p') - ord('P')  ]
  392.  
  393.      Larry now uses "Perl" to signify the language proper and "perl" the
  394.      implementation of it, i.e. the current interpreter.  Hence tchrist's quip
  395.      that "Nothing but perl can parse Perl."
  396.  
  397.      On the other hand, the aesthetic value of casewise parallelism
  398.      in "awk", "sed", and "perl" as much require the lower-case 
  399.      version as "C", "Pascal", and "Perl" require the 
  400.      upper-case version.  It's also easier to type "Perl" in 
  401.      typeset print than to be constantly switching in Courier. :-)
  402.     
  403.      In other words, it doesn't matter much, especially if all
  404.      you're doing is hearing someone talk about the language;
  405.      case is hard to distinguish aurally.
  406.  
  407.  
  408. 1.29) What companies use or ship Perl?
  409.  
  410.     At this time, the known list of companies that ship Perl includes at
  411.     least the following, although some have snuck it into /usr/contrib
  412.     or its moral equivalent:
  413.  
  414.     BSDI
  415.     Comdisco Systems
  416.     CONVEX Computer Corporation
  417.     Crosspoint Solutions
  418.     Dell
  419.     DRD Corporation
  420.     Intergraph
  421.     Kubota Pacific 
  422.     Netlabs
  423.     Univel
  424.  
  425.     Furthermore, the following vendors are reported to begin shipping perl
  426.     standard with their systems in the very near future:
  427.  
  428.     Sun
  429.     SGI
  430.  
  431.     Some companies ship it on their "User Contributed Software Tape",
  432.     such as DEC and HP.  Apple Computer has shipped the MPW version of
  433.     Macintosh Perl on one of their Developer CDs (Essentials*Tools*Objects 
  434.     #11) (and they included it under "Essentials" :-)
  435.  
  436.     Many other companies use Perl internally for purposes of tools
  437.     development, systems administration, installation scripts, and test
  438.     suites.  Rumor has it that the large workstation vendors (the TLA set)
  439.     are seriously looking into shipping Perl with their standard systems
  440.     "soon".
  441.  
  442.     People with support contracts with their vendors are actively 
  443.     encouraged to submit enhancement requests that Perl be shipped 
  444.     as part of their standard system.  It would, at the very least,
  445.     reduce the FTP load on the Internet. :-)
  446.  
  447.     If you know of any others, please send them in.
  448.  
  449.  
  450. 1.30) Is there commercial, 3rd-party support for Perl?
  451.  
  452.     Not really.  Although perl is included in the GNU distribution, at
  453.     last check, Cygnus does not offer support for it.  However, it's
  454.     unclear whether they've ever been offered sufficient financial
  455.     incentive to do so.
  456.  
  457.     On the other hand, you do have comp.lang.perl as a totally gratis
  458.     support mechanism.  As long as you ask "interesting" questions, 
  459.     you'll probably get plenty of help. :-)
  460.  
  461.     While some vendors do ship Perl with their platforms, that doesn't
  462.     mean they support it on arbitrary other platforms.  And in fact, all
  463.     they'll probably do is forward any bug reports on to Larry.  In
  464.     practice, this is far better support than you could hope for from
  465.     nearly any vendor.
  466.  
  467.     The companies who won't use something unless they can pay money
  468.     for it will be left out.  Often they're motivated by wanting 
  469.     someone whom they could sue.  If all they want is someone to help
  470.     them out with Perl problems, there's always the net.  And if they
  471.     really want to pay someone for that help, well, Tom and Randal are
  472.     always looking for a job. :-)
  473.  
  474.     If companies want "commercial support" for it badly enough, speak
  475.     up -- something might be able to be arranged.
  476.  
  477.  
  478. 1.31) Where can I get a list of the JAPH signature quotes?
  479.  
  480.     These are the "just another perl hacker" signatures that
  481.     some people sign their postings with.  About 100 of the 
  482.     of the earlier ones are on convex.com in /pub/perl/info/japh.
  483.  
  484. 1.32) Where can I get a list of Larry Wall witticisms?
  485.  
  486.     Over a hundred quips by Larry, from postings of his or source code,
  487.     can be found on convex.com in /pub/perl/info/lwall-quotes.  
  488.  
  489. 1.33) Is there a pretty-printer for Perl?
  490.  
  491.     That depends on what you mean.  If you want something 
  492.     that works like vgrind on Perl programs, then the answer
  493.     is "yes, nearly".  Here's a vgrind entry for perl:
  494.  
  495.     PERL|perl|Perl:\
  496.         :pb=^\d?(sub|package)\d\p\d:\
  497.         :bb={:be=}:cb=#:ce=$:sb=":se=\e":lb=':\
  498.         :le=\e':tl:\
  499.         :id=_:\
  500.         :kw=\
  501.         if for foreach unless until while continue else elsif \
  502.         do eval require \
  503.         die exit \
  504.         defined delete reset \
  505.         goto last redo next dump \
  506.         local undef return  \
  507.         write format  \
  508.         sub package
  509.  
  510.     It doesn't actually do everything right; in particular, 
  511.     things like $#, $', s#/foo##, and $foo'bar all confuse it.
  512.  
  513.     David Levine uses this:
  514.  
  515.     # perl 4.x                        David Levine <levine@ics.uci.edu> 05 apr 1993
  516.     # Derived from Tom  Christiansen's perl vgrindef.   I'd  like to  treat all  of
  517.     # perl's  built-ins  as   keywords,  but  vgrind   fields are  limited  to 1024
  518.     # characters   and  the built-ins  overflow that  (surprise  :-).  So, I didn't
  519.     # include  the dbm*,  end*, get*,  msg*,  sem*, set*,  and  shm* functions.   I
  520.     # couldn't come  up  with an easy   way to  distinguish beginnings  of literals
  521.     # ('...') from package prefixes, so literals are not marked.
  522.     # Be sure to:
  523.     # 1) include whitespace between a subprogram name and its opening {
  524.     # 2) include whitespace before a comment (so that $# doesn't get interpreted as
  525.     #    one).
  526.     perl4:\
  527.         :pb=^\d?(sub|package)\d\p\d:\
  528.         :id=$%@_:\
  529.         :bb=\e{:be=\e}:cb=\d\e#:ce=$:sb=\e":se=\e":\
  530.         :kw=accept alarm atan2 bind binmode caller chdir chmod chop chown \
  531.     chroot close closedir connect continue cos crypt defined delete die do dump \
  532.     each else elsif eof eval exec exit exp fcntl fileno flock for foreach fork \
  533.     format getc gmtime goto grep hex if include index int ioctl join keys kill \
  534.     last length link listen local localtime log lstat m mkdir next oct open \
  535.     opendir ord pack package pipe pop print printf push q qq qx rand read readdir \
  536.     readlink recv redo rename require reset return reverse rewinddir rindex rmdir \
  537.     s scalar seek seekdir select send shift shutdown sin sleep socket socketpair \
  538.     sort splice split sprintf sqrt srand stat study sub substr symlink syscall \
  539.     sysread system syswrite tell telldir time times tr truncate umask undef \
  540.     unless unlink unpack unshift until utime values vec wait waitpid wantarray \
  541.     warn while write y:
  542.  
  543.     If what you mean is whether there is a program that will
  544.     reformat the program much as indent(1) will do for C, then
  545.     the answer is no.  The complex feedback between the scanner
  546.     and the parser (as in the things that confuse vgrind) make
  547.     it challenging at best to write a stand-alone C parser.
  548.  
  549. 1.34) Can I dynamically load C user routines?
  550.  
  551.     Yes, kinda.  One package has been released that does this, by
  552.     Roberto Salama <rs@fi.gs.com>.  He writes:
  553.  
  554.     Here is a version of dylperl, dynamic linker for perl. The code here
  555.     is based on Oliver Sharp's May 1993 article in Dr. Dobbs Journal
  556.     (Dynamic Linking under Berkeley UNIX).
  557.  
  558.           dyl.h 
  559.           dyl.c - code extracted from Oliver Sharp's article
  560.  
  561.           hash.h
  562.           hash.c - Berkeley's hash functions, should use perl's but could not
  563.                be bothered
  564.  
  565.        dylperl.c - perl usersubs
  566.           user.c - userinit function
  567.  
  568.         sample.c - sample code to be dyl'ed
  569.        sample2.c -          "
  570.          test.pl - sample perl script that dyl's sample*.o
  571.  
  572.     The Makefile assumes that uperl.o is in /usr/local/src/perl/... You
  573.     will probable have to change this to reflect your installation. Other
  574.     than that, just type 'make'...
  575.  
  576.     The idea behind being able to dynamnically link code into perl is that
  577.     the linked code should become perl functions, i.e. they can be invoked
  578.     as &foo(...).  For this to happen, the incrementally code must use the
  579.     perl stack, look at sample.c to get a better idea.
  580.  
  581.     The few functions that make up this package are outlined below.
  582.  
  583.     &dyl("file.o"): dynamically link file.o. All functions and non-static
  584.            variables become visible from within perl. This
  585.            function returns a pointer to an internal hash table
  586.            corresponding to the symbol table of the newly loaded
  587.            code.
  588.  
  589.            eg: $ht = &dyl("sample.o")
  590.  
  591.            This function can also be called with the -L and -l ld options.
  592.  
  593.            eg: $ht = &dyl(""sample2.o", "-L/usr/lib", "-lm")
  594.                will also pick up the math library if sample.o
  595.                accesses any symbols there.
  596.  
  597.     &dyl_find("func"): find symbol 'func' and return its symbol table entry
  598.  
  599.     &dyl_functions($ht): print the contents of the internal hash table
  600.     &dyl_print_symbols($f): prints the contents of the symbol returned by dyl_find()
  601.  
  602.     There is very little documentation, maybe something to do for a future
  603.     release.  The files sample.o, and sample2.o contain code to be
  604.     incrementally loaded, test.pl is the test perl script.
  605.  
  606.     Comments are welcome. I submit this code for public consumption and,
  607.     basically, am not responsible for it in any way.
  608. -- 
  609.     Tom Christiansen      tchrist@cs.colorado.edu       
  610.             Consultant
  611.     Boulder Colorado  303-444-3212
  612.